package com.wy.allthingdone.activity;

import android.media.MediaPlayer;
import android.os.Bundle;
import android.widget.MediaController;
import android.widget.Toast;
import android.widget.VideoView;

import com.wy.allthingdone.R;

import org.xutils.view.annotation.ViewInject;

public class VideoViewActivity extends BaseActivity {
    @ViewInject(R.id.videoView)
    VideoView videoView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        setContentView(R.layout.activity_video_view);
        super.onCreate(savedInstanceState);
        videoView.setVideoPath(getIntent().getStringExtra("data"));
        videoView.setMediaController(new MediaController(this));
        videoView.requestFocus();
        videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
            @Override
            public void onCompletion(MediaPlayer mp) {
                Toast.makeText(getApplicationContext(), "播放完成!", Toast.LENGTH_SHORT).show();
            }
        });
    }
}
